import Vue from 'vue'
import Router from 'vue-router'

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar
    breadcrumb: false            if false, the item will hidden in breadcrumb(default is true)
  }
**/
export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true, name: 'login' },
  { path: '/404', component: () => import('@/views/404'), hidden: true, name: '404' },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index')
    }]
  },
  {
    path: '/linePromotion',
    component: Layout,
    // redirect: '/linePromotion/list',
    name: '地推管理',
    alwaysShow: true,
    hidden: false,
    meta: { title: '地推管理', icon: 'linePromotion', keepAlive: true },
    children: [
      {
        path: 'add',
        name: '新增地推',
        hidden: false,
        component: () => import('@/views/linePromotion/add'),
        meta: { title: '新增地推', icon: 'add', keepAlive: true }
      },
      {
        path: 'manage',
        name: '地推管理',
        component: () => import('@/views/linePromotion/manage'),
        meta: { title: '地推管理', icon: 'linePManage', keepAlive: true }
      },
      {
        path: 'list',
        name: '地推推广人',
        component: () => import('@/views/linePromotion/list'),
        meta: { title: '地推推广人', icon: 'table' }
      }

    ]
  },
  //   {
  //     path: '/teacher',
  //     component: Layout,
  //     name: '基础数据管理',
  //     alwaysShow: true,
  //     meta: { title: '基础数据管理', icon: 'example' },
  //     children: [
  //       {
  //         path: '/teacher/teacherList',
  //         component: () => import('@/views/teacher/index'),
  //         name: '讲师管理',
  //         meta: { title: '讲师管理', icon: 'table' }
  //       },
  //       {
  //         path: '/teacher/add',
  //         component: () => import('@/views/teacher/add'),
  //         name: '新增讲师',
  //         meta: { title: '新增讲师', icon: 'table' }
  //       }
  //     ]
  //   },

  {
    path: '/menberManage',
    component: Layout,
    name: '会员管理',
    alwaysShow: true,
    meta: { title: '会员管理', icon: 'manage' },
    children: [
      {
        path: '/menberManage/list',
        component: () => import('@/views/memberManage/list'),
        name: '会员管理',
        meta: { title: '会员管理', icon: 'member' }
      }
    ]
  }, {
    path: '/productManage',
    component: Layout,
    redirect: '/productManage/index',
    name: '商品管理',
    alwaysShow: true,
    hidden: false,
    meta: { title: '商品管理', icon: 'projectManage' },
    children: [
      {
        path: 'add',
        name: '新增商品',
        // redirect: '/productManage/index',
        component: () => import('@/views/productManage/add'),
        meta: { title: '新增商品', icon: 'add' }
      },
      {
        path: 'index',
        name: '商品管理',
        component: () => import('@/views/productManage/index'),
        meta: { title: '商品管理', icon: 'projectManage' }
      },
      {
        path: 'addRoom',
        name: '新增房型',
        // redirect: '/productManage/index',
        component: () => import('@/views/productManage/addRoom'),
        meta: { title: '新增房型', icon: 'add' }
      },
      {
        path: 'indexRoom',
        name: '房型管理',
        component: () => import('@/views/productManage/indexRoom'),
        meta: { title: '房型管理', icon: 'indexRoom' }
      },
      {
        path: 'addCarousel',
        name: '新增轮播图',
        component: () => import('@/views/productManage/addCarousel'),
        meta: { title: '新增轮播图', icon: 'add' }
      },
      {
        path: 'carouselList',
        name: '商城轮播图管理',
        component: () => import('@/views/productManage/carouselList'),
        meta: { title: '商城轮播图管理', icon: 'pic' }
      }
    ]
  }, {
    path: '/order',
    component: Layout,
    name: '会员订单管理',
    alwaysShow: true,
    meta: { title: '会员订单管理', icon: 'orderManage' },
    children: [
      {
        path: '/order/index',
        component: () => import('@/views/order/index'),
        name: '全部订单',
        meta: { title: '全部订单', icon: 'allOrder' }
      },
      {
        path: '/order/noPay',
        component: () => import('@/views/order/noPay'),
        name: '未支付订单',
        meta: { title: '未支付订单', icon: 'noPay' }
      },
      {
        path: '/order/pay',
        component: () => import('@/views/order/pay'),
        name: '已支付订单',
        meta: { title: '已支付订单', icon: 'isPay' }
      }
    ]
  },
  {
    path: '/storeOrder',
    component: Layout,
    redirect: '/storeOrder/index',
    name: '商城订单管理',
    alwaysShow: true,
    hidden: false,
    meta: { title: '商城订单管理', icon: 'store' },
    children: [
      {
        path: 'index',
        name: '全部订单',
        component: () => import('@/views/storeOrder/index'),
        meta: { title: '全部订单', icon: 'stroeOrder' }
      },
      {
        path: 'noPayOrder',
        name: '未付款订单',
        component: () => import('@/views/storeOrder/noPayOrder'),
        meta: { title: '未付款订单', icon: 'noPayOrder' }
      },
      {
        path: 'isPayOrder',
        name: '已付款订单',
        component: () => import('@/views/storeOrder/isPayOrder'),
        meta: { title: '已付款订单', icon: 'isPayOrder' }
      },
      {
        path: 'shipped',
        name: '已发货订单',
        component: () => import('@/views/storeOrder/shipped'),
        meta: { title: '已发货订单', icon: 'noPayOrder' }
      },
      {
        path: 'received',
        name: '已收货订单',
        component: () => import('@/views/storeOrder/received'),
        meta: { title: '已收货订单', icon: 'isPayOrder' }
      },
      {
        path: 'completed',
        name: '已完成订单',
        component: () => import('@/views/storeOrder/completed'),
        meta: { title: '已完成订单', icon: 'completed' }
      },
      {
        path: 'canceled',
        name: '已取消订单',
        component: () => import('@/views/storeOrder/canceled'),
        meta: { title: '已取消订单', icon: 'canceled' }
      }
    ]
  },
  // 酒店订单
  {
    path: '/hotel',
    component: Layout,
    redirect: '/hotel/index',
    name: '酒店订单管理',
    alwaysShow: true,
    hidden: false,
    meta: { title: '酒店订单管理', icon: 'hotel' },
    children: [
      {
        path: 'index',
        name: '全部订单',
        component: () => import('@/views/hotel/index'),
        meta: { title: '全部订单', icon: 'allOrder' }
      },
      {
        path: 'confirmCheckIn',
        name: '确认入住订单',
        component: () => import('@/views/hotel/confirmCheckIn'),
        meta: { title: '确认入住订单', icon: 'confirmCheckIn' }
      },
      {
        path: 'noPay',
        name: '未付款订单',
        component: () => import('@/views/hotel/noPay'),
        meta: { title: '未付款订单', icon: 'noPayOrder' }
      },
      {
        path: 'waitConfirm',
        name: '待确认订单',
        component: () => import('@/views/hotel/waitConfirm'),
        meta: { title: '待确认订单', icon: 'waitConfirm' }
      },
      {
        path: 'alreadyConfirm',
        name: '已确认订单',
        component: () => import('@/views/hotel/alreadyConfirm'),
        meta: { title: '已确认订单', icon: 'alreadyConfirm' }
      },
      {
        path: 'refundApply',
        name: '退款申请订单',
        component: () => import('@/views/hotel/refundApply'),
        meta: { title: '退款申请订单', icon: 'refundApply' }
      },
      {
        path: 'refuseRefund',
        name: '拒绝退款订单',
        component: () => import('@/views/hotel/refuseRefund'),
        meta: { title: '拒绝退款订单', icon: 'refuseRefund' }
      },
      {
        path: 'alreadyRefund',
        name: '已退款订单',
        component: () => import('@/views/hotel/alreadyRefund'),
        meta: { title: '已退款订单', icon: 'alreadyRefund' }
      },
      {
        path: 'alreadyFinish',
        name: '已完成订单',
        component: () => import('@/views/hotel/alreadyFinish'),
        meta: { title: '已完成订单', icon: 'alreadyFinish' }
      },
      {
        path: 'alreadyCancel',
        name: '已取消订单',
        component: () => import('@/views/hotel/alreadyCancel'),
        meta: { title: '已取消订单', icon: 'alreadyCancel' }
      }
    ]
  },
  {
    path: '/financial',
    component: Layout,
    name: '财务管理',
    meta: { title: '财务管理', icon: 'cash' },
    children: [
      {
        path: '/financial/withdrawCash',
        component: () => import('@/views/financial/withdrawCash'),
        name: '佣金提现管理',
        meta: { title: '佣金提现管理', icon: 'takeCash' }
      },
      {
        path: '/financial/platformApplyForCash',
        component: () => import('@/views/financial/platformApplyForCash'),
        name: '平台抽佣提现管理',
        meta: { title: '平台抽佣提现管理', icon: 'platformApplyForCash' }
      }
    ]
  },
  {
    path: '/platformCommission',
    component: Layout,
    name: '平台抽佣',
    meta: { title: '平台抽佣', icon: 'platformCommission' },
    children: [
      {
        path: '/platformCommission/commissionEdit',
        component: () => import('@/views/platformCommission/commissionEdit'),
        name: '平台抽佣设置',
        meta: { title: '平台抽佣设置', icon: 'commissionEdit' }
      },
      {
        path: '/platformCommission/applyForCash',
        component: () => import('@/views/platformCommission/applyForCash'),
        name: '抽佣提现申请',
        meta: { title: '抽佣提现申请', icon: 'applyForCash' }
      },
      {
        path: '/platformCommission/withdrawalOrder',
        component: () => import('@/views/platformCommission/withdrawalOrder'),
        name: '提现订单详情',
        meta: { title: '提现订单详情', icon: 'takeCash' }
      }
    ]
  },
  //   {
  //     path: '/memberCenter',
  //     component: Layout,
  //     redirect: '/memberCenter/list',
  //     name: '会员中心',
  //     alwaysShow: true,
  //     hidden: false,
  //     meta: { title: '会员中心', icon: 'linePromotion' },
  //     children: [
  //       {
  //         path: 'add',
  //         name: '新增会员等级',
  //         component: () => import('@/views/memberCenter/add'),
  //         meta: { title: '新增会员等级', icon: 'add' }
  //       },
  //       {
  //         path: 'levelManage',
  //         name: '会员等级管理',
  //         component: () => import('@/views/memberCenter/levelManage'),
  //         meta: { title: '会员等级管理', icon: 'linePManage' }
  //       },
  //       {
  //         path: 'memberManage',
  //         name: '会员管理',
  //         component: () => import('@/views/memberCenter/memberManage'),
  //         meta: { title: '会员管理', icon: 'table' }
  //       },
  //       {
  //         path: 'memberDetail',
  //         name: '会员详情',
  //         component: () => import('@/views/memberCenter/memberDetail'),
  //         meta: { title: '会员详情', icon: 'table' }
  //       }
  //     ]
  //   },
  {
    path: '/shippingAddress',
    component: Layout,
    // redirect: '/shippingAddress/list',
    name: '发货地址管理',
    alwaysShow: true,
    hidden: false,
    meta: { title: '发货地址管理', icon: 'adress' },
    children: [
      {
        path: 'add',
        name: '新增发货地址',
        component: () => import('@/views/shippingAddress/add'),
        meta: { title: '新增发货地址', icon: 'add' }
      },
      {
        path: 'list',
        name: '发货地址管理',
        component: () => import('@/views/shippingAddress/list'),
        meta: { title: '发货地址管理', icon: 'adress' }
      }
    ]
  },
  {
    path: '/companyAccount',
    component: Layout,
    // redirect: '/shippingAddress/list',
    name: '对公账号管理',
    alwaysShow: true,
    hidden: false,
    meta: { title: '对公账号管理', icon: 'companyAccount' },
    children: [
      {
        path: 'add',
        name: '新增对公账号',
        component: () => import('@/views/companyAccount/add'),
        meta: { title: '新增对公账号', icon: 'add' }
      },
      {
        path: 'list',
        name: '对公账号管理',
        component: () => import('@/views/companyAccount/list'),
        meta: { title: '对公账号管理', icon: 'companyAccount' }
      }
    ]
  },
  {
    path: '/service',
    component: Layout,
    // redirect: '/shippingAddress/list',
    name: '客服管理',
    alwaysShow: true,
    hidden: false,
    meta: { title: '客服管理', icon: 'serviceManage' },
    children: [
      {
        path: 'add',
        name: '新增客服',
        component: () => import('@/views/service/add'),
        meta: { title: '新增客服', icon: 'add' }
      },
      {
        path: 'index',
        name: '客服管理',
        component: () => import('@/views/service/index'),
        meta: { title: '客服管理', icon: 'serviceManage' }
      }
    ]
  },
  {
    path: '/source',
    component: Layout,
    // redirect: '/shippingAddress/list',
    name: '商品溯源管理',
    alwaysShow: true,
    hidden: false,
    meta: { title: '商品溯源管理', icon: 'source' },
    children: [
      {
        path: 'sourceStepAdd',
        name: '新增溯源环节模版',
        component: () => import('@/views/source/sourceStepAdd'),
        meta: { title: '新增溯源环节模版', icon: 'table' }
      },
      {
        path: 'sourceStep',
        name: '溯源环节模版管理',
        component: () => import('@/views/source/sourceStep'),
        meta: { title: '溯源环节模版管理', icon: 'sourceStep' }
      },
      {
        path: 'sourceGoodsAdd',
        name: '新增溯源商品',
        component: () => import('@/views/source/sourceGoodsAdd'),
        meta: { title: '新增溯源商品', icon: 'table' }
      },
      {
        path: 'sourceGoodsConfig',
        name: '配置溯源商品',
        component: () => import('@/views/source/sourceGoodsConfig'),
        meta: { title: '配置溯源商品', icon: 'rebate' }
      },
      {
        path: 'sourceGoods',
        name: '溯源商品管理',
        component: () => import('@/views/source/sourceGoods'),
        meta: { title: '溯源商品管理', icon: 'sourceGoods' }
      },
      {
        path: 'createCode',
        name: '标码管理',
        component: () => import('@/views/source/createCode'),
        meta: { title: '标码管理', icon: 'sourceCode' }
      },
      {
        path: 'sourceCode',
        name: '溯源标码',
        component: () => import('@/views/source/sourceCode'),
        meta: { title: '溯源标码', icon: 'sourceCode' }
      },
      {
        path: 'batch',
        name: '溯源商品批次',
        component: () => import('@/views/source/batch'),
        meta: { title: '溯源商品批次', icon: 'batch' }
      },
      {
        path: 'batchUpLineConfig',
        name: '上链配置',
        component: () => import('@/views/source/batchUpLineConfig'),
        meta: { title: '上链配置', icon: 'membersRebate' }
      },
      {
        path: 'createCodeDetail',
        name: '生成明细',
        component: () => import('@/views/source/createCodeDetail'),
        meta: { title: '生成明细', icon: 'createCodeDetail' }
      }
    ]
  },
  {
    path: '/setting',
    component: Layout,
    // redirect: '/shippingAddress/list',
    name: '设置',
    alwaysShow: true,
    hidden: false,
    meta: { title: '设置', icon: 'setting' },
    children: [
      {
        path: 'goodsType',
        name: '商品类型设置',
        component: () => import('@/views/setting/goodsType'),
        meta: { title: '商品类型设置', icon: 'goodsType' }
      },
      //   {
      //     path: 'rebate',
      //     name: '分销返点设置',
      //     component: () => import('@/views/setting/rebate'),
      //     meta: { title: '分销返点设置', icon: 'rebate' }
      //   },
      //   {
      //     path: 'discount',
      //     name: '会员折扣设置',
      //     component: () => import('@/views/setting/discount'),
      //     meta: { title: '会员折扣设置', icon: 'discount' }
      //   },
      //   {
      //     path: 'membersRebate',
      //     name: '复利返点设置',
      //     component: () => import('@/views/setting/membersRebate'),
      //     meta: { title: '复利返点设置', icon: 'membersRebate' }
      //   }
      {
        path: 'roomsType',
        name: '房型类型设置',
        component: () => import('@/views/setting/roomsType'),
        meta: { title: '房型类型设置', icon: 'roomType' }
      }
    ]
  },
  {
    path: '/redirect',
    component: Layout,
    // redirect: '/',
    hidden: true,
    children: [{
      path: 'redirect',
      name: 'redirect',
      component: () => import('@/views/layout/components/Sidebar/redirect')
    }]
  },
  {
    path: '/basic',
    component: Layout,
    redirect: '/basic/user/list',
    name: '权限管理',
    alwaysShow: true,
    meta: { title: '权限管理', icon: 'userSetting' },
    children: [
      {
        path: '/basic/user/list',
        component: () => import('@/views/basic/user/list'),
        name: '用户管理',
        meta: { title: '用户管理', icon: 'userSetting1' }
      },
      {
        path: '/basic/user/add',
        component: () => import('@/views/basic/user/add'),
        name: '新增用户',
        meta: { title: '新增用户', icon: 'table' }
      },
      {
        path: '/basic/role/list',
        component: () => import('@/views/basic/role/list'),
        name: '角色管理',
        meta: { title: '角色管理', icon: 'roleSetting' }
      },
      {
        path: '/basic/role/add',
        component: () => import('@/views/basic/role/add'),
        name: '新增角色',
        meta: { title: '新增角色', icon: 'table' }
      },
      {
        path: '/basic/role/permissionEdit',
        component: () => import('@/views/basic/role/permissionEdit'),
        name: '角色权限设置',
        meta: { title: '角色权限设置', icon: 'table' }
      }
    ]
  },
  {
    path: '/qklBrowser',
    component: Layout,
    redirect: '/qklBrowser',
    name: '区块链浏览器',
    meta: { title: '区块链浏览器', icon: '' },
    children: [
      {
        path: '/qklBrowser/index',
        component: () => import('@/views/qklBrowser/index'),
        name: '区块链浏览器',
        meta: { title: '区块链浏览器', icon: '' }
      }
    ]
  },
  { path: '*', redirect: '/404', hidden: true }
  // {
  //   path: '/basic',
  //   component: Layout,
  //   redirect: '/basic/user/list',
  //   name: '基础设置',
  //   meta: { title: '基础设置', icon: 'example' },
  //   children: [
  //     {
  //       path: '/basic/user',
  //       name: '用户管理',
  //       component: () => import('@/views/basic/user'),
  //       meta: { title: '用户管理', icon: 'table' },
  //       children: [
  //         {
  //           path: '/basic/user/list',
  //           component: () => import('@/views/basic/user/list'),
  //           name: 'userList',
  //           meta: { title: '用户列表', icon: '' }
  //         },
  //         {
  //           path: '/basic/user/add',
  //           component: () => import('@/views/basic/user/add'),
  //           name: 'userAdd',
  //           meta: { title: '用户新增', icon: '' }
  //         }
  //       ]
  //     },
  //     {
  //       path: '/role/list',
  //       name: '角色管理',
  //       component: () => import('@/views/basic/role'),
  //       meta: { title: '角色管理', icon: 'table' },
  //       children: [
  //         {
  //           path: '/basic/role/list',
  //           component: () => import('@/views/basic/role/list'),
  //           name: 'roleList',
  //           meta: { title: '角色权限设置', icon: '' }
  //         },
  //         {
  //           path: '/basic/role/add',
  //           component: () => import('@/views/basic/role/add'),
  //           name: 'roleAdd',
  //           meta: { title: '角色新增', icon: '' }
  //         }
  //       ]
  //     }
  //   ]
  // },
  // {
  //   path: '/user',
  //   component: Layout,
  //   name: '用户管理',
  //   children: [
  //     {
  //       path: 'userLook',
  //       component: () => import('@/views/user/index'),
  //       name: '用户查看',
  //       meta: { title: '用户查看', icon: 'example' }
  //     }
  //   ]
  // },
  //   {
  //     path: '/add',
  //     name: '新增',
  //     component: () => import('@/views/product/add'),
  //     meta: { title: '新增', icon: 'table' }
  //   },
  //   {
  //     path: '/teacherAdd',
  //     component: () => import('@/views/teacher/add'),
  //     hidden: true
  //   },

]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
